package com.rrd.hive.udf;

import java.util.regex.Pattern;

import org.apache.hadoop.hive.ql.exec.UDF;
import org.apache.hadoop.io.Text;

/**
*
*@author liubaoxin
*@date 2019年11月21日
*/
public class FormatFeeUDF extends UDF {

    private Text res = new Text();
    private static Pattern pattern = Pattern.compile(",");
    public Text evaluate(String actFee) {
    	if(actFee==null || actFee.equals("")){
    		return null;
    	}
        String arr[] = pattern.split(actFee);
        StringBuilder sb = new StringBuilder();
        for(String s: arr){
        	if(!s.equals("")){
        		sb.append(s).append("#");
        	}
        }
        res.set(sb.toString());
        return this.res;
    }
}
